#include <stdio.h>

int main(void) {
	int a, b, c, d;
	int e, f;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	f = d - b;
	e = c - a;
	if (f < 0) {
		f += 60;
		e = c - a - 1;
	}
	printf("%d %d", e, f);
	return 0;
}